﻿using Newtonsoft.Json.Converters;

namespace Face8280WebSocketServerTest.Models
{
    public class FeatureDataModel
    {
        public FeatureDataModel()
        {
            //BinaryData = data;
            //Type = type;
            //DataType = dataType;
            //Len = BinaryData?.Length ?? 0;
           // CheckValue();
        }
        /// <summary>
        /// 文件序号
        /// </summary>
        public int Num { get; set; }
        /// <summary>
        /// 类型 1、人脸特征码:face,2、指纹特征码:fp  + (索引号 1-10);3、人员头像:photo( jpg格式)
        /// </summary>
        [Newtonsoft.Json.JsonConverter(typeof(StringEnumConverter))]
        public FeatureType Type { get; set; }
        /// <summary>
        /// 数据大小
        /// </summary>
        public int Len { get; set; }
        /// <summary>
        /// dataType 有三种格式
        /// Base64，则data字段为base64字符串
        /// Url，则data字段为一个http/https开头的url
        /// Stream，则表示文件已二进制流方式传输，需要等待后续包
        /// </summary>
        [Newtonsoft.Json.JsonConverter(typeof(StringEnumConverter))]
        public FeatureDataType DataType { get; set; }
        /// <summary>
        /// 数据内容
        /// </summary>
        public string Data { get; set; }

        public string Md5 { get; set; }
        [Newtonsoft.Json.JsonIgnore]
        public byte[] BinaryData { get; set; }
        //[Newtonsoft.Json.JsonIgnore]
        //public byte[] DataBytes { get; private set; }
    }
    /// <summary>
    /// 文件类型
    /// </summary>
    public enum FeatureType
    {
        /// <summary>
        /// 人脸特征
        /// </summary>
        Face,
        /// <summary>
        /// 指纹特征1
        /// </summary>
        Fp1,
        /// <summary>
        /// 指纹特征2
        /// </summary>
        Fp2,
        /// <summary>
        /// 指纹特征3
        /// </summary>
        Fp3,
        /// <summary>
        /// 指纹特征4
        /// </summary>
        Fp4,
        /// <summary>
        /// 指纹特征5
        /// </summary>
        Fp5,
        /// <summary>
        /// 指纹特征6
        /// </summary>
        Fp6,
        /// <summary>
        /// 指纹特征7
        /// </summary>
        Fp7,
        /// <summary>
        /// 指纹特征8
        /// </summary>
        Fp8,
        /// <summary>
        /// 指纹特征9
        /// </summary>
        Fp9,
        /// <summary>
        /// 指纹特征10
        /// </summary>
        Fp10,
        /// <summary>
        /// 人脸头像
        /// </summary>
        Photo
    }

    /// <summary>
    /// 数据类型
    /// </summary>
    public enum FeatureDataType
    {
        Base64,
        Url,
        Stream


    }
}
